// pages/order/order.js
const app = getApp()
Page({
  data: {
      show:false,
      winWidth: 0,
      winHeight: 0,
      currentTab: 0,
      listviewnoneShow:true,
      jinShow:false,
      teaPrice:0,
      img:"",
      productIcon:"",
      teaname:"",
      jialiao:""
  },
  jinshow:function(e){
   wx.switchTab({
     url: '../diancan/diancan',
   })
   //this.setData({listviewnoneShow:app.globalData.listviewnoneShow});
  },
  mes:function(e){
    var myischange = !this.data.show;
      this.setData({show:myischange})
  },
  onLoad: function(e) {
      var that = this;
      console.log(app.globalData.productIcon)
      console.log(app.globalData.productName)
      console.log(app.globalData.productPrice)
      console.log(app.globalData.productDesc)
      // img = app.globalData.productIcon;
      
      /**
       * 获取当前设备的宽高
       */
      wx.getSystemInfo( {

          success: function( res ) {
              that.setData( {
                  winWidth: res.windowWidth,
                  winHeight: res.windowHeight
              });
          }

      });
  },
  onShow:function(e){
    this.setData({teaPrice:app.globalData.allprice})
    // console.log("onshow"+this.data.teaPrice)
    this.setData({img:app.globalData.img})
    this.setData({teaname:app.globalData.teaName})
    this.setData({jialiao:app.globalData.LastResult.jialiao})
    this.setData({jinShow:app.globalData.jinShow});
    this.setData({listviewnoneShow:app.globalData.listviewnoneShow});
    console.log("listviewnoneShow:=="+app.globalData.listviewnoneShow);
  //  console.log("jinshow:=="+app.globalData.jinShow);
    for (let i=0,l=app.globalData.LastResult.length;i<l;i++){
    //    console.log(app.globalData.LastResult[i].jialiao)
        this.setData({
            jialiao:app.globalData.LastResult[i].jialiao,
        })
    }
  },
    
//  tab切换逻辑
  swichNav: function( e ) {

      var that = this;

      if( this.data.currentTab === e.target.dataset.current ) {
          return false;
      } else {
          that.setData( {
              currentTab: e.target.dataset.current
          })
      }
  },

  bindChange: function( e ) {

      var that = this;
      that.setData( { currentTab: e.detail.current });

  },
})